/**
 * 
 */
package com.cuc.platform.core.componet.security.domain;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * @author peepul
 * 
 * 系统认证角色类
 * 
 * ss_role表的对应POJO
 */
public class SecurityRole implements Serializable{
	private static final long serialVersionUID = 5484434873703964371L;
	
	private Long id;//pk
	private String name;
	private String isAdmin;//是否系统角色
	private String descn;
	
	private List<SecurityUser> users = new ArrayList<SecurityUser>();
	private List<SecurityAuthority> auths = new ArrayList<SecurityAuthority>();
	private SecurityMenu menu;
	
	/**
	 * @return the menu
	 */
	public SecurityMenu getMenu() {
		return menu;
	}

	/**
	 * @param menu the menu to set
	 */
	public void setMenu(SecurityMenu menu) {
		this.menu = menu;
	}

	private SecurityAuthority auth;
	
	/**
	 * @return the auth
	 */
	public SecurityAuthority getAuth() {
		return auth;
	}

	/**
	 * @param auth the auth to set
	 */
	public void setAuth(SecurityAuthority auth) {
		this.auth = auth;
	}

	/**
	 * @return the auths
	 */
	public List<SecurityAuthority> getAuths() {
		return auths;
	}

	/**
	 * @param auths the auths to set
	 */
	public void setAuths(List<SecurityAuthority> auths) {
		this.auths = auths;
	}

	/**
	 * @return the users
	 */
	public List<SecurityUser> getUsers() {
		return users;
	}
	
	/**
	 * @param users the users to set
	 */
	public void setUsers(List<SecurityUser> users) {
		this.users = users;
	}
	
	/**
	 * @return the id
	 */
	public Long getId() {
		return id;
	}
	
	/**
	 * @param id the id to set
	 */
	public void setId(Long id) {
		this.id = id;
	}
	
	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}
	
	/**
	 * @param name the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}
	
	/**
	 * @return the isAdmin
	 */
	public String getIsAdmin() {
		return isAdmin;
	}
	
	/**
	 * @param isAdmin the isAdmin to set
	 */
	public void setIsAdmin(String isAdmin) {
		this.isAdmin = isAdmin;
	}
	/**
	 * @return the descn
	 */
	public String getDescn() {
		return descn;
	}
	
	/**
	 * @param descn the descn to set
	 */
	public void setDescn(String descn) {
		this.descn = descn;
	}
	
	/**
	 * default construtor
	 */
	public SecurityRole() {
		super();
	}
	
	/**
	 * @param id
	 * @param name
	 * @param descn
	 */
	public SecurityRole(Long id, String name, String descn) {
		super();
		this.id = id;
		this.name = name;
		this.descn = descn;
	}
	/* (non-Javadoc)
	 * @see java.lang.Object#hashCode()
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((descn == null) ? 0 : descn.hashCode());
		result = prime * result + ((id == null) ? 0 : id.hashCode());
		result = prime * result + ((name == null) ? 0 : name.hashCode());
		return result;
	}
	
	/* (non-Javadoc)
	 * @see java.lang.Object#equals(java.lang.Object)
	 */
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		SecurityRole other = (SecurityRole) obj;
		if (descn == null) {
			if (other.descn != null)
				return false;
		} else if (!descn.equals(other.descn))
			return false;
		if (id == null) {
			if (other.id != null)
				return false;
		} else if (!id.equals(other.id))
			return false;
		if (name == null) {
			if (other.name != null)
				return false;
		} else if (!name.equals(other.name))
			return false;
		return true;
	}
}
